﻿using Simulation.Framework;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine;
using System.Collections.Generic;
using System.Collections;

namespace Easy.Game2d {

    public partial class UIPlayStatePanle : PanelBase {

        public TMPro.TextMeshProUGUI TexthpTextMeshProUGUI{get;private set;}

        public TMPro.TextMeshProUGUI TextvalueTextMeshProUGUI{get;private set;}

        public TMPro.TextMeshProUGUI NumberLayersTextMeshProUGUI{get;private set;}

        public UnityEngine.UI.Button ButtonStopButton{get;private set;}

        public UnityEngine.UI.Button ButtonPageButton{get;private set;}

        public UnityEngine.UI.Button ButtonExitButton{get;private set;}

        public UnityEngine.UI.Button StoreButtonButton{get;private set;}

        public UnityEngine.UI.Image HQImageImage{get;private set;}

        public UnityEngine.UI.Image SDImageImage{get;private set;}

        #region control
        private void InitComponent() {
            // init
            TexthpTextMeshProUGUI = transform.Find("ImageHP/Texthp").GetComponent<TMPro.TextMeshProUGUI>();
            TextvalueTextMeshProUGUI = transform.Find("ImageValue/Textvalue").GetComponent<TMPro.TextMeshProUGUI>();
            NumberLayersTextMeshProUGUI = transform.Find("NumberLayers ").GetComponent<TMPro.TextMeshProUGUI>();
            ButtonStopButton = transform.Find("ButtonStop").GetComponent<UnityEngine.UI.Button>();
            ButtonPageButton = transform.Find("ButtonPage").GetComponent<UnityEngine.UI.Button>();
            ButtonExitButton = transform.Find("ButtonExit").GetComponent<UnityEngine.UI.Button>();
            StoreButtonButton = transform.Find("StoreButton").GetComponent<UnityEngine.UI.Button>();
            HQImageImage = transform.Find("ImageHuoQiu/HQImage").GetComponent<UnityEngine.UI.Image>();
            SDImageImage = transform.Find("ImageShanDian/SDImage").GetComponent<UnityEngine.UI.Image>();

            // button
            ButtonStopButton.onClick.RemoveAllListeners();
            ButtonStopButton.onClick.AddListener(OnButtonStopButtonClicked);
            ButtonPageButton.onClick.RemoveAllListeners();
            ButtonPageButton.onClick.AddListener(OnButtonPageButtonClicked);
            ButtonExitButton.onClick.RemoveAllListeners();
            ButtonExitButton.onClick.AddListener(OnButtonExitButtonClicked);
            StoreButtonButton.onClick.RemoveAllListeners();
            StoreButtonButton.onClick.AddListener(OnStoreButtonButtonClicked);
        }

        private void ClearComponent() {
            // button
            ButtonStopButton?.onClick.RemoveAllListeners();
            ButtonPageButton?.onClick.RemoveAllListeners();
            ButtonExitButton?.onClick.RemoveAllListeners();
            StoreButtonButton?.onClick.RemoveAllListeners();

            // clear
            TexthpTextMeshProUGUI = null;
            TextvalueTextMeshProUGUI = null;
            NumberLayersTextMeshProUGUI = null;
            ButtonStopButton = null;
            ButtonPageButton = null;
            ButtonExitButton = null;
            StoreButtonButton = null;
            HQImageImage = null;
            SDImageImage = null;
        }
        #endregion
    }
}
